N,K=map(int,input().split())

a=[i for i in range(1,N+1)]

class node:
    key=0
    time=0
    type=-1#0借 1还
    def __init__(self,key,time,type):
        self.key=key
        self.time=time
        self.type=type
    #重载小于运算符，这样可以对此类对象数组进行排序
    def __lt__(self,n1):
        if self.time<n1.time:
            return True
        elif self.time>n1.time:
            return False
        else:
            if self.type>n1.type:
                return True
            elif self.type<n1.type:
                return False
            else:
                return self.key<n1.key


caozuo=[]

for i in range(0,K):
    key,start_t,end_t=map(int,input().split())
    caozuo.append(node(key,start_t,0))
    caozuo.append(node(key,start_t+end_t,1))


caozuo.sort()

for item in caozuo:
    #借
    if item.type==0:
        for i in range(0,N):
            if a[i]==item.key:
                a[i]=0
                break
    #还
    else:
        for i in range(0,N):
            if a[i]==0:
                a[i]=item.key
                break

for item in a:
    print(item,end=" ")
print("")